home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: lafn.org!an234
- From: an234@lafn.org (Andres Lessing)
- Subject: Re: Can someone help me with fopen
- X-Nntp-Posting-Host: lafn.org
- Message-ID: <1996Feb14.070619.20564@lafn.org>
- Sender: news@lafn.org
- Reply-To: an234@lafn.org (Andres Lessing)
- Organization: The Los Angeles Free-Net
- References: <4fouoo$k0e@news.uncc.edu>
- Date: Wed, 14 Feb 1996 07:06:19 GMT
-
-
- In a previous article, ssfeebac (Samuel S Feeback) says:
-
- >Here is my problem. I am trying to read a text file, search for a certain
- >string and write that string to an outfile. I am having trouble with the fopen
- >commnad. Here is a fragment of my code.
- >
- >char input; /* variable to put filename in*/
- >FILE *infile /* Pointer to File to be used as input */
- >
- >if (argv[argc] == "-i")
- > {input = ((argv[argc]) + 1);
- > infile = fopen((("%s", input), "r"));
- > if ((infile = fopen((("%s", input), "r"))) == NULL)
- > {/*Error Message*/
- >
- >
- >I keep getting an "too few arguments to function `fopen'
- >
- >Please e-mail me is you have any idea on this problem(or any other aspect of
- > this program for that matter :>)
- >Any help would be greatly appreciated
- >
- >ssfeebac@uncc.edu
- >
- >
-
- If I am not mistaken, I believe that fopen has the following parameters:
- fopen(filename,fileopenmode);
-
- for example here's how you would do it
-
- infile = fopen(input,"r");
- then you do your stuff.
-
- E-mail me if you have any questions...
- --
- Hofstadter's Law: | o__
- It always takes longer than you expect, even | _.</)_
- when you take Hofstadter's Law into account. | (_) \(_)
- " Godel Escher Bach" | Andres, an234@lafn.org
-